<?php if(isset($isInsert) && $isInsert){
?>
<script>
	ajax('listContent','<?php echo $this->params['controller'].'/lists/'.$pid?>');
	closeBox('addContent','mainContent');
</script>
<?php
}
else{
?>
<fieldset>
    <legend><?php _resource('edit'. $this->params['controller']);?></legend>
<center><div id="message">&nbsp;</div></center>
<?php if($this->Session->read('message')){
	echo '<script>showMessage("addContent","'.$this->Session->read('message').'");</script>';
	$this->Session->delete('message');	
	}?>
<?php if($this->Session->read('error')){
	echo '<script>showMessage("addContent","'.$this->Session->read('error').'",1);</script>';
	$this->Session->delete('error');
}?>
    <form id="adminForm" name="adminForm" method="post" action="<?php echo $this->params['controller']?>/edit/<?php echo $this->data[$uses[0]]['id'].'/'.$pid.'/'.$locale ?>"  onsubmit="onFormSubmit();return false;">
    <?php
		echo $this->Form->hidden($uses[0].'.id');		
		echo $this->Form->hidden($uses[0].'.view_order');
		echo $this->Form->hidden($uses[0].'.published');
		echo $this->Form->hidden($uses[0].'.home');
		
		if($webConfig['is_multi_lang']){
			echo $this->Form->hidden($uses[0].'.defaulttitle');
			echo $this->Form->hidden($uses[0].'.defaultdescription');
			echo $this->Form->hidden($uses[0].'.defaultcontent');
			
		}				

	?>
	<table border="0" class="form" style="width:100%">
       	<tr>          
       		<td class="label" align="right" width="100px"><?php _resource('title') ?>
       		<?php if($webConfig['is_multi_lang']){?>
       		<img class="Tips1" title="<?php echo $listLang[$locale]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$locale.'.png'?>">
       		<?php }?>
       		</td>
       		<td align="left"><?php echo $this->Form->input(	$uses[0].'.title',array('onkeyup'=>'onEnterSubmit(this,event,"onFormSubmit()")','class'=>'input_require','label'=>'','size'=>60,'maxlength'=>255));?></td>           
        </tr>
        <?php if($locale!=$this->Session->read('adminLang') && $webConfig['is_multi_lang']){?>
        	<tr>
            	<td class="label" align="right" width="100px"><?php _resource('title') ?> <img class="Tips1" title="<?php echo $listLang[$this->Session->read('adminLang')]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$this->Session->read('adminLang').'.png'?>"></td>
            	<td colspan="2"><?php echo $this->data[$uses[0]]['defaulttitle'] ?></td>
          	</tr>
        <?php }?>   
        
       <?php if(isset($this->data[$uses[0]]['oldimage'])&& !empty($this->data[$uses[0]]['image'])){?>
        <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('old image') ?></td>
       		<td align="left"><img style="opacity: 1;" src="<?php echo $this->webroot.'uploaded/'.$uses[0].'/thumb/'.$this->data[$uses[0]]['oldimage'] ?>"></td>
       	</tr>
       	<?php }?>
       	        
        <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('new image') ?>
       		
       		</td>
       		<td align="left">
       			<?php echo $this->Form->input($uses[0].'.image',array('type'=>'hidden','class'=>'input','label'=>'','size'=>60,'maxlength'=>255));?>
       			<div id="fine-uploader-thumb">
       				<?php if(isset($this->data[$uses[0]]['image'])&& !empty($this->data[$uses[0]]['image'])){?>
		       			<img style="opacity: 1;" src="<?php echo $this->webroot.'uploaded/'.$uses[0].'/thumb/'.$this->data[$uses[0]]['image'] ?>">
		       		<?php }?>
       			</div>
       			<div id="fine-uploader" style="margin-top:10px"></div>   
        	</td>
        </tr>
        
        
         <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('description') ?>
       		<?php if($webConfig['is_multi_lang']){?>
       		<img class="Tips1" title="<?php echo $listLang[$locale]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$locale.'.png'?>">
       		<?php }?>
       		</td>
       		<td align="left"><?php echo $this->Form->textarea($uses[0].'.description',array('class'=>'','label'=>'','error'=>'','cols'=>120,'rows'=>5));?></td>           
        </tr> 
        <?php if($locale!=$this->Session->read('adminLang') && $webConfig['is_multi_lang']){?>
        	<tr>
            	<td class="label" align="right" width="100px"><?php _resource('description') ?> <img class="Tips1" title="<?php echo $listLang[$this->Session->read('adminLang')]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$this->Session->read('adminLang').'.png'?>"></td>
            	<td colspan="2"><div style="margin-top: 0px;border: solid 1px #000000;height: 200px; width:710px;overflow: auto"><?php echo $this->data[$uses[0]]['defaultdescription'] ?></div></td>
          	</tr>
        <?php }?>   
        
        <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('content') ?>
       		<?php if($webConfig['is_multi_lang']){?>
       		<img class="Tips1" title="<?php echo $listLang[$locale]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$locale.'.png'?>">
       		<?php }?>
			</td>
       		<td align="left"><?php echo $this->Form->textarea($uses[0].'.content',array('class'=>'','label'=>'','error'=>'','cols'=>120,'rows'=>10));?></td>           
        </tr> 
        <?php if($locale!=$this->Session->read('adminLang') && $webConfig['is_multi_lang']){?>
        	<tr>
            	<td class="label" align="right" width="100px"><?php _resource('content') ?> <img class="Tips1" title="<?php echo $listLang[$this->Session->read('adminLang')]?>" border="0" src="<?php echo $this->webroot.'img/backend/flag/'.$this->Session->read('adminLang').'.png'?>"></td>
            	<td colspan="2"><div style="margin-top: 0px;border: solid 1px #000000;height: 300px; width:710px;overflow: auto"><?php echo $this->data[$uses[0]]['defaultcontent'] ?></div></td>
          	</tr>
        <?php }?> 
        
            <tr>          
            <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('is rating') ?>
       		
       		</td>
       		<td align="left"><?php echo $this->Form->input($uses[0].'.recipe',array('onkeyup'=>'onEnterSubmit(this,event,"onFormSubmit()")','label'=>'','size'=>60,'maxlength'=>255));?></td>           
        </tr>
        <tr>          
       		<td class="label" align="right" width="100px"><?php _resource('price') ?>
       		
       		</td>
       		<td align="left"><?php echo $this->Form->input($uses[0].'.recipe_calories',array('onkeyup'=>'onEnterSubmit(this,event,"onFormSubmit()")','label'=>'','size'=>60,'maxlength'=>255));?></td>           
        </tr>
       		<td class="label" align="right" width="100px"><?php _resource('keyword') ?>
       		
       		</td>
       		<td align="left"><?php echo $this->Form->input($uses[0].'.tag',array('onkeyup'=>'onEnterSubmit(this,event,"onFormSubmit()")','label'=>'','size'=>60,'maxlength'=>255));?></td>           
        </tr>
         
	</table>
	<center>
	<div id="editor">
	</div>
    <div style="width:130px">
          <div class="button"><a onclick="onFormSubmit()" href="javascript:;" title="<?php echo _resource('save') ?>"  > <span class="icon-32-save"> </span></a> </div>         
          <div class="button"><a onclick="resetForm('adminForm')" href="javascript:;" title="<?php echo _resource('reset') ?>"  > <span class="icon-32-back"> </span></a> </div>
          <div class="button"><a onclick="closeBox('addContent','mainContent')" href="javascript:;" title="<?php echo _resource('close') ?>"  > <span class="icon-32-cancel"> </span></a> </div>
    </div>
    </center>
      </form>
</fieldset>


<script>	
function onFormSubmit(){
	deactivateEditors();
	submitForm('adminForm','addContent');	
}

activateFineUploader('fine-uploader','image','<?echo $uses[0]?>','fine-uploader-thumb','<?php echo $uses[0]?>Image');
$('#<?php echo $uses[0]?>Title').focus();
activateEditor('<?php echo $uses[0].'Content' ?>');
	scrollTopTo('addContent');		

	

</script>
<?php } ?>
